<?php
/**
 * taobao SDK
 * 
 * @version $Id: pinyin.php 30 2011-10-12 09:52:02Z linsir123 $
 */

$base = APP_DIR.'Vendors/pinyin/';
App::registerClass('Chinese', $base.'chinese.php');


/**
 * 中文转拼音
 */
function string2pinyin($string)
{
	$base = APP_DIR.'Vendors/pinyin/data/';
	$chs = new Chinese('UTF8', 'GB2312', $string, $base);
	$string = $chs->ConvertIT ();
	$chs = new Chinese('GB2312', 'PinYin', $string, $base);
	$string = $chs->ConvertIT();
	$string = strtolower($string);
	
	return preg_replace("/[^a-z0-9]+/i", "", $string);
}
